package com.xzy.service.impl;

import com.xzy.custom.Page;
import com.xzy.entities.BookInformation;
import com.xzy.entities.BookType;
import com.xzy.mapper.BookRepertoryMapper;
import com.xzy.mapper.BookTypeMapper;
import com.xzy.service.BookTypeService;
import com.xzy.web.form.BookTypeForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * TODO70
 *
 * @author Administrator
 * ClassName: BookTypeServiceImpl
 * date: 2021/11/23 15:06
 */
@Service
public class BookTypeServiceImpl implements BookTypeService{

    @Autowired
    private BookTypeMapper bookTypeMapper;
    @Autowired
    private BookRepertoryMapper BookRepertoryMapper;

    @Override
    public List<BookType> findAllBookType(Page page,String name) {
        return bookTypeMapper.findAllBookType(page,name);
    }

    @Override
    public BookType findById(Integer id) {
        return bookTypeMapper.findById(id);
    }

    @Override
    public void updateById(BookTypeForm form) {
       bookTypeMapper.updateById(form);
    }

    @Override
    public void insertType(BookTypeForm form) {
        bookTypeMapper.insertType(form);
    }

    @Override
    public void deleteById(int parseInt) {
        BookRepertoryMapper.deleteByBookId(parseInt);
        bookTypeMapper.delBookType(parseInt);
    }

    @Override
    public Integer findBookInformationCount(Page page,String name) {
        return bookTypeMapper.findBookInformationCount(page,name);
    }

    @Override
    public List<BookType> findAllBookType1() {
        return bookTypeMapper.findAllBookType1();
    }

}
